<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>DI码管理</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <!-- 避免IE使用兼容模式 -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link rel="stylesheet" href="../../../static/css/bootstrap.min.css" th:href="@{/css/bootstrap.min.css}">
    <link rel="stylesheet" href="../../../static/udi/dist/css/layui.css" th:href="@{/udi/dist/css/layui.css}">
    <link href="../../../static/css/font-awesome.min.css" th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
    <!-- bootstrap-table 表格插件样式 -->
    <link href="../../../static/ajax/libs/bootstrap-table/bootstrap-table.min.css" th:href="@{/ajax/libs/bootstrap-table/bootstrap-table.min.css}" rel="stylesheet"/>
    <link href="../../../static/css/animate.css" th:href="@{/css/animate.css}" rel="stylesheet"/>
    <link href="../../../static/css/style.css" th:href="@{/css/style.css}" rel="stylesheet"/>
    <link href="../../../static/udi/css/jt-ui.css" th:href="@{/udi/css/jt-ui.css}" rel="stylesheet"/>
    <style>
        div.xrequired:before {
            content: '*';
            color: red;
        }
        .span {
            position:relative;
            padding:5px;
        }
        .tip {
            display:block;
            background:#f00;
            border-radius:50%;
            width:8px;
            height:8px;
            top:0px;
            right:0px;
            position:absolute;
        }
    </style>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="form-di-list">
                <div class="select-list">
                    <ul>
                        <li>
                            企业名称：<input type="text" name="deptName" id="deptName"/>
                        </li>
                        <li>
                            器械标识：<input type="text" name="di" id="di"/>
                        </li>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()">
                    <i class="fa fa-plus"></i>&nbsp;&nbsp;新增
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()">
                    <i class="fa fa-trash"></i>&nbsp;&nbsp;删除
                </a>
                <a class="btn btn-info multiple disabled" onclick="$.operate.exportExcel()">
                    <i class="fa fa-upload"></i>&nbsp;&nbsp;批量导出
                </a>
                <a class="btn btn-info" onclick="$.table.importTemplate()">
                    <i class="fa fa-download"></i>&nbsp;&nbsp;模板填写规范下载
                </a>
            </div>
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<!-- 全局js -->
<th:block th:include="include :: footer" />
<script src="../../../static/js/jquery.min.js" ></script>
<script src="../../../static/js/bootstrap.min.js" ></script>
<script src="../../../static/ajax/libs/bootstrap-table/bootstrap-table.min.js" ></script>
<script src="../../../static/ajax/libs/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="../../../static/udi/dist/layui.js"></script>
<script src="../../../static/ajax/libs/blockUI/jquery.blockUI.js"></script>
<script src="../../../static/udi/js/common.js"></script>
<script src="../../../static/udi/js/jt-ui.js"></script>
<script th:inline="javascript">
    var datas = [[${@dict.getType('dt_code_status')}]];

    $(function (){
        var prefix = "/dimange";
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            removeUrl: prefix + "/del",
            detailUrl: prefix + "/detail/{id}",
            exportUrl: "/download/di",
            importTemplateUrl: prefix + "/importTemp",
            sortName: "di_id",
            modalName: "DI码表",
            uniqueId:"di",
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: 'ID',
                    align: 'center'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-info btn-xs" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.id + '\')">详情</a> ');
                        return actions.join('');
                    }
                },
                {
                    field: 'deptName',
                    title: '企业名称',
                    align: 'center',sortable: true
                },
                {
                    field: 'di',
                    title: '已生成的DI码',
                    align: 'center',
                    sortable: true
                },
                {
                    field: 'type',
                    title: '包装类型',
                    align: 'center',
                },
                {
                    field: 'status',
                    title: '状态',
                    align: 'center',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(datas, value);
                    }
                },
                {
                    field: 'addTime',
                    title: '生成时间'
                }]
        };
        $.table.init(options);
    })

    //格式化时间
    function getNowFormatDate() {
        var now = new Date();
        var date = now.getFullYear()
            + "-" + (now.getMonth()>8?(now.getMonth()+1):"0"+(now.getMonth()+1))
            + "-" + (now.getDate()>9?now.getDate():"0"+now.getDate())
            + " " + (now.getHours()>9?now.getHours():"0"+now.getHours())
            + ":" + (now.getMinutes()>9?now.getMinutes():"0"+now.getMinutes())
            + ":" + (now.getSeconds()>9?now.getSeconds():"0"+now.getSeconds());
        return date;
    }
</script>
</body>
</html>